package com.xht.controller;

import com.xht.domain.ResponseResult;
import com.xht.domain.entity.Video;
import com.xht.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/content/video")
public class VideoController {

    @Autowired
    private VideoService videoService;

    /**
     * 显示视频列表
     */
    @GetMapping("/list")
    public ResponseResult videoList(Integer pageNum, Integer pageSize) {
        return videoService.GetVideoList(pageNum, pageSize);
    }

    /**
     * 添加视频
     */
    @PostMapping
    public ResponseResult addVideo(@RequestBody Video video) {
        return videoService.addVideo(video);
    }

    /**
     * 逻辑删除视频
     */
    @DeleteMapping("/{id}")
    public ResponseResult deleteVideo(@PathVariable Integer id) {
        return videoService.deleteVideo(id);
    }

    /**
     * 获取视频详情信息
     */
    @GetMapping("/{id}")
    public ResponseResult getVideo(@PathVariable Integer id) {
        return videoService.getVideo(id);
    }

    /**
     * 更新视频
     */
    @PutMapping
    public ResponseResult updateVideo(@RequestBody Video video) {
        return videoService.updateVideo(video);
    }
}
